//============================================================================
// Copyright (C) 2003-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================
#include "RcSysPktLib.h"
#include <VxUtilLib/VxChop.h>

void RcSysPktOfferSystemMsg::AddMsg( std::string & csMsg )
{
	vx_assert( csMsg.size() );
	char * pTemp = (char *)( const char * ) csMsg.c_str();
	if( RC_SYS_PKT_OFFER_MAX_SYSTEM_MSG_LEN < csMsg.size() )
	{
		pTemp[ RC_SYS_PKT_OFFER_MAX_SYSTEM_MSG_LEN ] = 0;
	}
	VxChopStr( pTemp, m_au8Additional );
	m_u16PktLen = 4 + m_au8Additional[ 0 ];
}



void RcSysPktOfferSystemMsg::GetMsg( std::string & csMsg )
{
	if( m_au8Additional[ 0 ] )
	{
		char as8Buf[ RC_SYS_PKT_OFFER_MAX_SYSTEM_MSG_LEN + 1 ];
		VxUnchopStr( m_au8Additional, as8Buf );
		csMsg = as8Buf;
	}
	else
	{
		csMsg = "";
		vx_assert( FALSE );
	}
}

